package javaweb_work01.main.Dao;

import javaweb_work01.login.Utils.DruidUtils;
import javaweb_work01.main.Entity.Students;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ArrayListHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class CheckClassesIdDaoImp implements CheckClassesIdDao{
    @Override
    public List<Object[]> checkClassesId() {
        try {
            //使用连接池创建QueryRunner对象
            QueryRunner qr = new QueryRunner(DruidUtils.getDataSource());
            //编写sql语句
            String sql = "select cid from class";
            //执行语句
            List<Object[]> query = qr.query(sql, new ArrayListHandler());
            //返回结果集
            return query;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
